package complex.java.io;

import java.io.BufferedReader;
import java.io.FileReader;

//从一份文件中读取内容
public class BufferedInputFilter {
	public static void main(String[] args) {

		read();

	}

	public static String read() {
		try {
			BufferedReader in = new BufferedReader(
					new FileReader(
							"D:\\work\\project\\own\\complex\\complex.java\\src\\main\\resources\\test.txt"));
			String s;
			StringBuffer sb = new StringBuffer();

			// \r换行 \n回车
			while ((s = in.readLine()) != null) {
				sb.append(s + "\n");
			}
			in.close();
			System.out.println(sb.toString());
			return sb.toString();
		//	System.out.println(sb.toString());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return "";
		}
	}
}
